<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE HTML>
<%-- <%@include file="edit.jsp"%> --%>
<html>
<head>
<script type="text/javascript">
	$(function() {
		//添加界面的附件管理
		$("#file_upload_img").on('click',function(){
			toDeploy("jpg,png");
		});
		//添加界面的附件管理
		function toDeploy(extensions){
			showUpload({title:'上传封面'
				,options:{
					filters:{
						mime_types: [{title : "封面图片", extensions : extensions}]
					},
					multi_selection: false ,
					 init:{
						 FileUploaded:function(uploader,file,responseObject){
							 var response = responseObject.response;
							 var json = eval('(' + response + ')');
							 var data = json.data;
							 var path = data.fileUrl;
							 $("#entity_coverUrl").val(data.id);  //完成后更新已上传的文件列表
							 showImg(path);
						 }
					}
					,complete:function(){
						top.$ok('上传成功');
					}
				}
			});
		}
		function showImg(path){
			var html = '<img src="'+path+'" style="width:60px;heigth:60px;">';
			$("#td_showImg").html(html);
		}
		
		$('#enabled').radiobox({name:'entity.enabled',value:true,data:[[true,'有效'],[false,'无效']]});
		$('#toolbar').toolbar({buttons:[
			{name:'save',iconCls:'icon-save',text:'保存'}
	  	],handler:handler});
	});
	function handler() {
		switch(this.name) {
			case 'save': toSave();break;
		}
	}
	function toSave(){
		$.messager.progress({title:'系统提示',text:'数据处理中，请耐心等待...'});
		$.submit('#dataform',function(r) {
			$.messager.progress('close');
			if(r.code<0) return $alert(r.msg);
			top.$prompt('保存成功');
			top.$window.close(window,1,null);
		});
	}
</script>
</head>
<body>
	<div id="toolbar" class="toolbar" ></div>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'center',border:false">
			<form id="dataform" action="edit" method="post">
				<input type="hidden" name="entity.id" value="${item.id }" />
				<input type="hidden" name="entity.coverUrl" id="entity_coverUrl" value="${item.coverUrl }" />
				<table class="form-tbl">
					<tr class="form-tr">
						<th class="form-th">圈子名称:</th>
						<td class="form-td" colspan="2">
							<input type="text" name="entity.groupName" value="${item.groupName }" class="form-text" style="width:170px;" />
						</td>
					</tr>
					<tr class="form-tr">
						<td class="form-th">上传封面</td>
						<td id="td_showImg" class="form-td">
							<img src="${ctx}${item.coverUrl}" style="width:60px;heigth:60px;">
						</td>
						<td id="td_img">
							<div>
	                            <input class="easyui-validatebox" type="hidden" id="img_id" name="imgId" />
	                            <input id="file_upload_img" name="file_upload_img" type="file" multiple="multiple">
	                        </div>
						</td>
					</tr>
					<tr class="form-tr">
						<th class="form-th">圈子备注:</th>
						<td class="form-td" colspan="2">
							<input class="easyui-textbox" name="entity.groupNote" value="${item.groupNote }" style="width:100%;height:60px" data-options="multiline:true">
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</body>
</html>